import gdata.spreadsheet.text_db
import my_auth
from socket import gethostname
from datetime import datetime
import time

cred = my_auth.credentials()

username = cred.name
password = cred.pw
db_name = 'reg.log'
sheet_name = 'Sheet 1'

client = gdata.spreadsheet.text_db.DatabaseClient()
client.SetCredentials(username,password)
time.sleep(1)

db = client.GetDatabases(name=db_name)[0]
table = db.GetTables(name=sheet_name)[0]

user = gethostname()
dt = datetime.fromtimestamp(time.time())
time_stamp = dt.strftime('%m/%d/%Y_%H:%M:%S')

table.AddRecord({'user':user,'timestamp':time_stamp})

print user, time_stamp